@import '../ivscss-tools';
// 输出的字符串需要双引号
// false为默认输出，true为不需要
$ivs-STRNEEDQUOTE: false;

// ivs-remove-q
// 是否允许 $q：删除数量 超出被查找的值的最大数量
$ivs-allow-q-out: true !default;
$ivs-ALLOWQOUT: $ivs-allow-q-out;
// 是否允许 $v：查找值 不存在
$ivs-allow-v-notfind: true !default;
$ivs-ALLOWVNOTFIND: $ivs-allow-v-notfind;

// 配置错误信息
	// 1 - 返回false
	// 2 - 提示中文错误
	// 3 - 提示英文错误
	// 4 - 输出代码所在位置
// 内置错误
$ivs-ERRORMAP-ADMIND: (
	'e01': (
		type: 2,
		func: 'string>_strParseNum:ivs-s-parseNu',
		msg: (
			'zh-cn': '输入的字符串不能转换为数值。',
			'en': 'The string is not allowed to be converted to a number.'
		),
	),
	'e02': (
		type: 2,
		func: 'list>_remove:ivs-l-removeItemByIndex',
		msg: (
			'zh-cn': '索引值超出列表长度',
			'en': 'index out of bounds'
		)
	),
	'e03': (
		type: 2,
		func: 'list>_remove:ivs-l-removeItemByValue',
		msg: (
			'zh-cn': '找不到这个值，请确认是否是类型不一致导致。',
			'en': 'This value cannot be found'
		)
	),
	'e04': (
		type: 2,
		func: 'core>ivs-parseNum',
		msg: (
			'zh-cn': '不支持Map格式转换。',
			'en': "Type of map is not allowed here."
		)
	),
	'e05': (
		type: 2,
		func: 'list>_remove:ivs-l-removeItemByValue',
		msg: (
			'zh-cn': '找不到要替换的值，请检查是否因为字符串或数字的关系导致。',
			'en': "Can't find the word, please check the input type of value is correctly."
		)
	),
	'e06': (
		type: 2,
		func: 'map>_handle:ivs-m-handle',
		msg: (
			'zh-cn': '第一个参数输入不合法，只允许输入get或has',
			'en': 'The first value can only be "get" or "has"'
		)
	),
	'e07': (
		type: 2,
		func: 'string>_splice:ivs-s-splice | list>_splice:ivs-l-splice',
		msg: (
			'zh-cn': '起始索引值过大或过小，请重新输入',
			'en': 'The value of index is too large or too small'
		)
	),
	'e08': (
		type: 2,
		func: '_core:ivs-splice | _core:ivs-splice-q',
		msg: (
			'zh-cn': '期望输入的是列表或字符串',
			'en': 'Expect to get string or list.'
		)
	),
	'e09': (
		type: 2,
		func: 'list,number,string>_remove:ivs-*-removeItemByValue',
		msg: (
			'zh-cn': '$q超出被查找值里的最大数量/长度',
			'en': 'Exceeded the maximum number in the searched value.'
		)
	),
	'e10': (
		type: 2,
		func: '_core:ivs-splice-q',
		msg: (
			'zh-cn': '要截取的数量不能为负，或许你是希望使用ivs-splice方法',
			'en': 'Negative number not allowed.'
		)
	)
);

@function ivs-getErrorMsg($errType) {
	$newMapErrorInfo: ();
	@each $key,$val in $errType {
		$typeTemp: map-get($val, type);
		$mapTemp: map-get($ivs-ERRORMAP-ADMIND, $key);
		$newMapErrorInfoTemp: (
			$key: (
				type: $typeTemp,
				func: map-get($mapTemp, func),
				msg: map-get($mapTemp, msg)
			)
		);
		$newMapErrorInfo: map-merge($newMapErrorInfo, $newMapErrorInfoTemp);
	}
	@return $newMapErrorInfo;
}
// @error $ivs-errortype;
$ivs-errortype: () !default;
$ivs-ERRORMAP-USER: ivs-getErrorMsg($ivs-errortype);
$ivs-ERRORMAP: map-merge($ivs-ERRORMAP-ADMIND, $ivs-ERRORMAP-USER);
